/**
 * 
 */
package VendingMachine;


import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;

/**
 * @author Xuraj
 *
 */
public class VendingMachineItemTest {
	
	VendingMachineItem vmi;
	/**
	 * @throws java.lang.Exception
	 */
	@Before
	public void setUp() throws Exception {
		vmi = new VendingMachineItem("Candy", 5.0); 
	}
	
	/**
	 * This test will check if an exception is thrown when item is priced less than 0 
	 */
	@Test
	public void testVendingMachineItemConstructor() {
		new VendingMachineItem("Candy", 1.0);
	}
	/**
	 * This test will check if an exception is thrown when item is priced less than 0 
	 */
	@Test
	public void testVendingMachineInvalidItemConstructor() {
		new VendingMachineItem("Candy", -1.0);
	}
	
	/**
	 * This test will check the getName() method to get Name after new item is created
	 */
	@Test
	public void testVendingMachineItemName() {
		assertEquals("Candy", vmi.getName());
		
	}
	
	/**
	 * This test will check the getPrice() method to get Price after new item is created
	 */
	@Test
	public void testVendingMachineItemPrice() {
		assertEquals(5.0, vmi.getPrice(),0.001);
		
	}
}
